package cn.hwh.springframework.context.event;

import cn.hwh.springframework.beans.factory.BeanFactory;
import cn.hwh.springframework.context.ApplicationEvent;
import cn.hwh.springframework.context.ApplicationListener;

/**
 * @author wenhao hu
 * @title: SimpleApplicationEventMulticaster
 * @projectName mini-spring
 * @description: TODO
 * @date 2022/2/1515:17
 */
public class SimpleApplicationEventMulticaster extends AbstractApplicationEventMulticaster{

    public SimpleApplicationEventMulticaster(BeanFactory beanFactory){
        setBeanFactory(beanFactory);
    }


    @Override
    public void multicastEvent(ApplicationEvent event) {
        for (ApplicationListener listener : getApplicationListeners(event)) {
            listener.onApplicationEvent(event);
        }
    }
}
